home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2006 May / PCpro_2006_05.ISO / files / mobile / fma-2.0-stable-setup.exe / {app} / source / uStatusDlg.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2004-06-15  |  1.7 KB  |  83 lines

  1. unit uStatusDlg;
  2.  
  3. {
  4. *******************************************************************************
  5. * Descriptions: Main Unit for FMA
  6. * $Source: /cvsroot/fma/fma/uStatusDlg.pas,v $
  7. * $Locker:  $
  8. *
  9. * Todo:
  10. *
  11. * Change Log:
  12. * $Log: uStatusDlg.pas,v $
  13. * Revision 1.3  2004/06/15 13:00:51  z_stoichev
  14. * Allow different window position usage.
  15. *
  16. * Revision 1.2  2003/12/11 14:04:44  z_stoichev
  17. * Removed Always on top.
  18. * Show as screen centered.
  19. *
  20. * Revision 1.1  2003/12/09 16:09:31  z_stoichev
  21. * Initial checkin.
  22. *
  23. *
  24. }
  25.  
  26. interface
  27.  
  28. uses
  29.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  30.   Dialogs, StdCtrls, ExtCtrls;
  31.  
  32. type
  33.   TfrmStatusDlg = class(TForm)
  34.     Image1: TImage;
  35.     Label1: TLabel;
  36.     procedure FormCreate(Sender: TObject);
  37.   private
  38.     { Private declarations }
  39.   public
  40.     { Public declarations }
  41.     procedure Status(Msg: string);
  42.   end;
  43.  
  44. var
  45.   frmStatusDlg: TfrmStatusDlg;
  46.  
  47. function ShowStatusDlg(Msg: string; Where: TPosition = poScreenCenter): TfrmStatusDlg;
  48.  
  49. implementation
  50.  
  51. {$R *.dfm}
  52.  
  53. function ShowStatusDlg(Msg: string; Where: TPosition): TfrmStatusDlg;
  54. begin
  55.   Result := TfrmStatusDlg.Create(nil);
  56.   with Result do begin
  57.     Position := Where;
  58.     Status(Msg);
  59.     Show;
  60.     Update;
  61.   end;
  62. end;
  63.  
  64. procedure TfrmStatusDlg.FormCreate(Sender: TObject);
  65. begin
  66.   Image1.Picture.Icon.Assign(Application.Icon);
  67. end;
  68.  
  69. procedure TfrmStatusDlg.Status(Msg: string);
  70. var
  71.   w: integer;
  72. begin
  73.   w := Label1.Width;
  74.   Label1.Caption := Msg;
  75.   Width := Label1.Left + Label1.Width + 32;
  76.   if Visible then begin
  77.     Left := Left - (Label1.Width - w) div 2;
  78.     Update;
  79.   end;
  80. end;
  81.  
  82. end.
  83.